package com.company.gas.service.impl;

import com.company.gas.mapper.SystemUserMapper;
import com.company.gas.pojo.SystemUser;
import com.company.gas.service.ISystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class SystemUserServiceImpl implements ISystemUserService {
    @Autowired
    private SystemUserMapper systemUserMapper;
    //查询全部用户
    @Override
    public List<SystemUser> querySystemUserList(){
        return systemUserMapper.querySystemUserList();
    }
    //通过ID查找单个用户
    @Override
    public SystemUser querySystemUserByID(String userId){
        SystemUser systemUser = systemUserMapper.querySystemUserByID(userId);
        return systemUser;
    }
    //增加用户
    @Override
    public int addSystemUser(String userId, String password, String privilege, Boolean flag, String createBy, String modifyBy){
        systemUserMapper.addSystemUser(userId, password, privilege, flag, createBy, modifyBy);
        return  1;
    }
    //删除用户
    @Override
    public int deleteSystemUserByID(String userId){
        systemUserMapper.deleteSystemUserByID(userId);
        return 1;
    }
    //修改用户
    @Override
    public int updateSystemUser(String userId, String password, String privilege, String modifyBy){
        systemUserMapper.updateSystemUser(userId, password, privilege, modifyBy);
        return 1;
    }
}